package util;


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

import util.Properties;

public class Properties {
	
	private static java.util.Properties properties;
	
	public static String getProperty(String key){
		if(Properties.properties == null){
			loadProperties();
		}
		
		return Properties.properties.getProperty(key);
	}

	private static void loadProperties() {
		File propertiesFolder = new File("properties");
		
		File[] properties = propertiesFolder.listFiles();

		Properties.properties = new java.util.Properties();
		try {
			for(File property : properties)
			{
				if(!property.getName().equals(".svn"))
				{
					Properties.properties.load(new FileInputStream(property));
				}
			}
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
